<?php

class commentsComponents extends sfComponents {

    public function executeBlock() {
        
    }

    public function executeComments() {
        $q = CommentTable::getInstance()->createQuery('c')
                ->select('c.rating, c.comment_text, gu.first_name as user_name, gu.username as username, DATE_FORMAT(created_at, "%l:%i:%S %p %M %d, %Y") as days_diff')
                ->leftJoin('c.sfGuardUser gu')
                ->where('dos_id = ?', $this->model_id)
                ->orderBy('created_at DESC')
                ->andWhere('is_approved = TRUE');
        $this->comments = $q->fetchArray();
        $this->count = $q->count();
    }

}
